<template>
	<view class="me">
		<my-header bgColor="bg-gradual-blue" :isBack="false">
			<block slot="backText">返回</block>
			<block slot="content">个人中心</block>
		</my-header>
        <view class="bgHeader"></view>
        <view class="user_info row">
            <image class="avatar" :src="user.avatarUrl" mode="" />
            <view class="info">
                <view class="name">{{user.nickName}}</view>
				<vieew class="sex row">
					性别：
					<view v-if="user.gender==1" class="cuIcon-male  man"></view>
					<!-- <view v-if="user.gender==1" class="cuIcon-female woman"></view> -->
					<view v-if="user.gender==2" class="cuIcon-female woman"></view>
				</vieew>
            </view>
        </view>
		<view class="list">
			<view class="item row" v-for="(item,index) in list" :key="index" @click="go(item)">
				<image v-if="item.type=='img'" class="icon" :src="item.icon"/>
				<view v-else class="icon" :class="item.icon"></view>
				{{item.name}}
                <!-- {{item.type}} -->
				<view class="cuIcon-right right"></view>
                <button  v-if="item.link=='service'"  open-type="contact"	class="btn"></button>
                <button  v-if="item.link=='feedback'"  open-type="feedback"	class="btn"></button>
                
			</view>
		</view>
			
		<my-footer cur="1"></my-footer>

	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				user:{},
				list:[
					// {
                    // // "icon"=>$url."zhifu-yue.png",
					// 	icon:"/static/icon/link.png",
					// 	name:"复制链接",
					// 	type:"img",
					// 	link:"http://localhost:8080/"
					// },
					// #ifndef MP-WEIXIN
                    // #endif
                    {
                        icon:"cuIcon-info",
						name:"关于我们",
						link:"/pages/about/index"
                    },
                    {
						icon:"cuIcon-service",
						name:"联系我们",
						link:"service"
					},
                    {
						icon:"cuIcon-post",
						name:"意见反馈",
						link:"feedback"
                    },
                    {
                        icon:"cuIcon-fork",
						name:"更新日志",
						link:"/pages/about/version"
                    }
					
				]
			}
		}, 
		async created(){
			this.initData()
		},
		methods: {
			async initData(){
				let user=await getApp().get_userInfo()
				this.user=user
            },
			go(item){
				if (item.type=="copy") {
					let openid= uni.getStorageSync('openid')
					uni.$copy(item.link+"?"+openid)
				}else{
					uni.navigateTo({
						url:item.link,
						success:(res)=>{
							console.log(res);
						},
						fail:(err)=>{
							console.log(err);
						}
					});
				}
				
			},
			
			
		}
	}
</script>

<style lang="scss">
	@import "../main";
</style>